package com.wh.hotel.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luweije
 */

@Getter
@AllArgsConstructor
public enum GuaranteeTypeEnum {

    ALL(0, "全额担保"),
    FIRST_NIGHT(1, "首晚担保"),
    NOT_NEED(2, "无需担保"),
    ;

    private final int code;
    private final String desc;

    public static GuaranteeTypeEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (GuaranteeTypeEnum guaranteeTypeEnum : GuaranteeTypeEnum.values()) {
            if (guaranteeTypeEnum.getCode() == code) {
                return guaranteeTypeEnum;
            }
        }
        return null;
    }
}
